package inet.db.pool;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class DBConfig {

	/**
	 * @param args
	 */
	public static boolean databaseEnabled = true;
	public static String operator = "";
	public static String db_driver_service = "";//"oracle.jdbc.driver.OracleDriver";

	public static String db_url_service = "";//jdbc:oracle:thin:@192.168.1.6:1521:ISERVEDV";

	public static String db_user_service = "";//"AUTHENSERVER";
	
	public static String db_pass_service = "";//123456";
	public static int min_limit = 2;

	public static int max_limit = 50;

	public static int initial_limit = 2;

	public static int ConnectionWaitTimeout = 5;

	public static boolean ValidateConnection = true;
	
	
	public static Properties props = new Properties();
	public DBConfig() {
		try {
			loadProperties();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static void loadProperties() throws IOException {
		// TODO Auto-generated method stub
		String fileName = "conf\\database.conf";
		//System.out.println(fileName);		
		props.load(new FileInputStream("conf\\database.conf"));    
		db_driver_service = props.getProperty("db_driver_service",
				db_driver_service);
		db_url_service = props.getProperty("db_url_service",
				db_url_service);
		db_user_service = props.getProperty("db_user_service",
				db_user_service);
		db_pass_service = props.getProperty("db_pass_service",
				db_pass_service);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Properties props = new Properties();
		String message="";
		//try retrieve data from file
        try {
        DBConfig newsonph=new DBConfig();
        newsonph.loadProperties();
       // System.out.println(newsonph.db_url_service);
         }
        catch (Exception e){
        	e.printStackTrace();
        }
	}

}
